
testPrinter(
'a = function(){}',

'a = function() {};',

'a=function(){}'
);

testPrinter(
'function asd(){ return 1 }',

'function asd() {\n\
	return 1;\n\
}',

'function asd(){return 1}'
);

testPrinter(
'a = function asd(b, c){  }',

'a = function asd(b, c) {};',

'a=function asd(b,c){}'
);

testPrinter(
'function a(){ return 1,2 }',

'function a() {\n\
	return 1, 2;\n\
}',

'function a(){return 1,2}'
);

testPrinter(
'function n(x){if (!x) x = 0; while(true) { var i = yield x++; if (i) x = i; }}',

'function n(x) {\n\
	var i;\n\
	if (!x)\n\
		x = 0;\n\
	while (true) {\n\
		i = yield x++;\n\
		if (i)\n\
			x = i;\n\
	}\n\
}',

'function n(x){var i;if(!x)x=0;while(true){i=yield x++;if(i)x=i}}'
);

testPrinter(
'(function(){})();',

'(function() {})();',

'(function(){})()'
);

testPrinter(
'(function(){}).call();',

'(function() {}).call();',

'(function(){}).call()'
);

testPrinter(
'(function() {}.call());',
'(function() {}).call();',
'(function(){}).call()'
);

testPrinter(
'function a() {\n\
	return function() {};\n\
}',

'function a() {\n\
	return function() {};\n\
}',

'function a(){return function(){}}'
);

testPrinter(
'function a() {\n\
	return function() {}(1);\n\
}',

'function a() {\n\
	return function() {}(1);\n\
}',

'function a(){return function(){}(1)}'
);

testPrinter(
'a(function() {})',
'a(function() {});',
'a(function(){})'
);

testPrinter(
'a(function() {}(1))',
'a(function() {}(1));',
'a(function(){}(1))'
);

testPrinter(
'+function() {}',
'+function() {};',
'+function(){}'
);

testPrinter(
'+function() {}(1)',
'+function() {}(1);',
'+function(){}(1)'
);

testPrinter(
'a[function() {}(1)]',
'a[function() {}(1)];',
'a[function(){}(1)]'
);

testPrinter(
'(function(){});',
'(function() {});',
'(function(){})'
);

testPrinter(
'(function a(){});',
'(function a() {});',
'(function a(){})'
);

testPrinter(
'function a(){};',
'function a() {}',
'function a(){}'
);

testPrinter(
'(function a(){}(1));',
'(function a() {})(1);',
'(function a(){})(1)'
);

testPrinter(
'function a(){}(1);',

'function a() {}\n\
1;',

'function a(){}1'
);

testPrinter(
'(function(){} + 1)',
'(function() {}) + 1;',
'(function(){})+1'
);

testPrinter(
'(1 + function(){})',
'1 + function() {};',
'1+function(){}'
);

testPrinter(
'1 + function(){}(1)',
'1 + function() {}(1);',
'1+function(){}(1)'
);

testPrinter(
'switch(function(){}) {}',
'switch (function() {}) {\n\
}',
'switch(function(){}){}'
);

// the extra variable declaration should be completely removed
testPrinter(
'function a(b) { var b; }',
'function a(b) {}',
'function a(b){}'
);
